package com.feri.ssm.service.impl;

import com.feri.ssm.dao.UserDao;
import com.feri.ssm.entity.User;
import com.feri.ssm.service.intf.UserService;
import com.feri.ssm.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao dao;

    @Override
    public R save(User user) {
        if (dao.insert(user)>0){
            return new R(200,"ok",null);
        }else {
            return new R(400,"新增用户失败",null);
        }
    }

    @Override
    public R queryAll() {
        return new R(200,"ok",dao.selectAll());
    }
    //原来的方法
    public R queryAll1(){
        long l=System.currentTimeMillis();
         R r=new R(200,"ok",dao.selectAll());
         System.err.println(System.currentTimeMillis()-l);
         return r;
    }


}
